import request from '@/utils/request';

export async function getCabinetQualityByPage(params: any) {
  return request('/api/quality/getCabinetQualityByPage', {
    method: 'POST',
    data: params,
  });
}

export async function addCabinetQuality(params: any) {
  return request('/api/quality/addCabinetQuality', {
    method: 'POST',
    data: params,
  });
}

export async function updateCabinetQuality(params: any) {
  return request('/api/quality/updateCabinetQuality', {
    method: 'POST',
    data: params,
  });
}

export async function delCabinetQuality(params: any) {
  return request('/api/quality/delCabinetQuality', {
    method: 'POST',
    data: params,
  });
}

export async function exportCabinetQuality(params: any) {
  return request('/api/quality/exportCabinetQuality', {
    method: 'POST',
    data: params,
    responseType: 'blob',
  });
}

//获取所有的工单编号和别名/api/product/getWorkOrderInforAndproductName
export async function getWorkOrderInforAndproductName() {
  return request('/api/product/getWorkOrderInforAndproductName', {
    method: 'POST',
  });
}

//获取批次信息
export async function getBatchPlanByPage(params: any) {
  return request('/api/project/getBatchPlanByPage', {
    method: 'POST',
    data: params,
  });
}

//获取错误类型
export async function getErroType(params: any) {
  return request('/api/project/getErroType', {
    method: 'POST',
    data: params,
  });
}

//获取工序
export async function getProductManufactExecInfosByWoId(params: any) {
  return request('/api/product/getProductManufactExecInfosByWoId', {
    method: 'POST',
    params: {
      woId: params,
    },
  });
}

//获取工序
export async function getProcessNamesByWo(params: any) {
  return request('/api/product/getProcessNamesByWo', {
    method: 'POST',
    params: {
      wo: params,
    },
  });
}

//新增接线错误（确定按钮）
export async function addErrorRecord(params: any) {
  return request('/api/product/addErrorRecord', {
    method: 'POST',
    data: params,
  });
}

//新增
export async function addCabinetQualityAndCabinetError(params: any) {
  return request('/api/quality/addCabinetQualityAndCabinetError', {
    method: 'POST',
    data: params,
  });
}

//编辑
export async function editCabinetQualityAndCabinetError(params: any) {
  return request('/api/quality/editCabinetQualityAndCabinetError', {
    method: 'POST',
    data: params,
  });
}
export async function getBatchPlanCode(params: any) {
  return request('/api/project/getBatchPlanCode', {
    method: 'POST',
    data: params,
  });
}

export async function getCabinetError(params: any) {
  return request('/api/quality/getCabinetError', {
    method: 'POST',
    params: {
      Id: params,
    },
  });
}

// 获取工单信息
export async function getWorkOrderInforByWo(params: any) {
  return request('/api/product/getWorkOrderInforByWo', {
    method: 'POST',
    params: {
      wo: params,
    },
  });
}

export async function getCabinetErrorByPage(params: any) {
  return request('/api/quality/getCabinetErrorByPage', {
    method: 'POST',
    data: params,
  });
}

export async function delCabinetError(params: any) {
  return request('/api/quality/delCabinetError', {
    method: 'POST',
    data: params,
  });
}

export async function getCabinetQualityInformationByWo(params: any) {
  return request('/api/quality/getCabinetQualityInformationByWo', {
    method: 'POST',
    params: {
      wo: params,
    },
  });
}

export async function getWos(params: any) {
  return request('/api/product/getWos', {
    method: 'POST',
    params: {
      s: params,
    },
  });
}

export default {
  getCabinetErrorByPage,
  getCabinetQualityByPage,
  addCabinetQuality,
  updateCabinetQuality,
  delCabinetQuality,
  exportCabinetQuality,
};
